/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package diet.dto;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
 * @author BadBoy
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "dietID",
    "customerID",
    "dateTimeBegin",
    "dateTimeEnd",
    "dietName",
    "calorieNeed",
    "isNew",})
public class DietDTO implements java.io.Serializable {

    @XmlElement(required = true)
    private int dietID;
    private int customerID;
    private Date dateTimeBegin;
    private Date dateTimeEnd;
    private String dietName;
    private int calorieNeed;
    private int isNew;


    public DietDTO() {
        this.dietID = 0;
        this.customerID = 0;
        this.dietName = "";
        this.calorieNeed = 0;
        this.isNew = 0;

        final int year = Calendar.getInstance().get(Calendar.YEAR);
        int month = Calendar.getInstance().get(Calendar.MONTH);
        int date = Calendar.getInstance().get(Calendar.DATE);
        String dateString = Integer.toString(year) + "-" + Integer.toString(month) + "-" + Integer.toString(date);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        try {
            this.dateTimeBegin = dateFormat.parse(dateString);
            this.dateTimeEnd = dateFormat.parse(dateString);
        } catch (ParseException ex) {
            this.dateTimeBegin = null;
            this.dateTimeEnd = null;
        }
    }

    /**
     * @return the dietID
     */
    public int getDietID() {
        return dietID;
    }

    /**
     * @param dietID the dietID to set
     */
    public void setDietID(int dietID) {
        this.dietID = dietID;
    }

    /**
     * @return the customerID
     */
    public int getCustomerID() {
        return customerID;
    }

    /**
     * @param customerID the customerID to set
     */
    public void setCustomerID(int customerID) {
        this.customerID = customerID;
    }

    /**
     * @return the dateTimeBegin
     */
    public Date getDateTimeBegin() {
        return dateTimeBegin;
    }

    /**
     * @param dateTimeBegin the dateTimeBegin to set
     */
    public void setDateTimeBegin(Date dateTimeBegin) {
        this.dateTimeBegin = dateTimeBegin;
    }

    /**
     * @return the dateTimeEnd
     */
    public Date getDateTimeEnd() {
        return dateTimeEnd;
    }

    /**
     * @param dateTimeEnd the dateTimeEnd to set
     */
    public void setDateTimeEnd(Date dateTimeEnd) {
        this.dateTimeEnd = dateTimeEnd;
    }

    /**
     * @return the dietName
     */
    public String getDietName() {
        return dietName;
    }

    /**
     * @param dietName the dietName to set
     */
    public void setDietName(String dietName) {
        this.dietName = dietName;
    }

    /**
     * @return the calorieNeed
     */
    public int getCalorieNeed() {
        return calorieNeed;
    }

    /**
     * @param calorieNeed the calorieNeed to set
     */
    public void setCalorieNeed(int calorieNeed) {
        this.calorieNeed = calorieNeed;
    }

    /**
     * @return the isNew
     */
    public int getIsNew() {
        return isNew;
    }

    /**
     * @param isNew the isNew to set
     */
    public void setIsNew(int isNew) {
        this.isNew = isNew;
    }


}
